<?php
declare (strict_types = 1);

namespace app\listener\api;

use app\service\logic\common\user\UserService;
use Exception;
use think\facade\Log;

class AfterUserListener
{
    /**
     * @param $argc
     * @return bool
     */
    public function handle($argc)
    {
        try {
            return invoke(UserService::class)->insertAccessTokenById($argc['id'], $argc['token']);
        } catch (Exception $e) {
            Log::debug('AfterUserListenerException: id=' . $argc['id'] . ', token=' . $argc['token'] . ', message=' . $e->getMessage());
            return true;
        }
    }
}
